/**
 * Created by user on 2018/4/18.
 */
const AnyProxy = require('anyproxy');
const env = process.env.NODE_ENV
// AnyProxy.utils.systemProxyMgr.enableGlobalProxy('127.0.0.1', '8005');
console.log(env)
const options = {
  port: 8001,
  rule: require('./myRuleModule'),
  webInterface: {
    enable: true,
    webPort: 8002
  },
  throttle: 10000,
  forceProxyHttps: true,
  wsIntercept: false, // 不开启websocket代理
  silent: false
};
const proxyServer = new AnyProxy.ProxyServer(options);

proxyServer.on('ready', () => { /* */ });
proxyServer.on('error', (e) => { /* */ });
if (env == 'start') {
  proxyServer.start();
}
if (env == 'stop') {
  proxyServer.close();
}

//https://github.com/wuyanwuyan/wechat-articles-crawler.git
